using System;
using System.Collections.Generic;
using System.Text;
using SpoonCore.Message.Storage;
using SpoonCore.Storage;

namespace SpoonCore.Handler
{
	class StorageHandler : IMessageHandler
	{
		private SpoonClient _client;
		
		#region IMessageHandler Members

		public void SetClient(SpoonClient client)
		{
			_client = client;
		}

		public void RegisterHandler(MessageHandler handler)
		{
			handler.RegisterHandler<StorageMessage>(new MessageHandler.OnMessageReceiveHandler<StorageMessage>(StorageReceive));
		}

		public void StorageReceive(StorageMessage msg, ClientInfo client)
		{
			if (msg.StorageType == StorageMessage.StorageTypeValue.Read)
			{
				if (msg.StorageStatus == StorageMessage.StorageStatusValue.Request)
				{
					//StorageItem item = _storage.Read(msg.Id);
				}
				else
				{
					/*StorageItem item = new StorageItem();
					_storage.DataReceive(item);*/
				}
			}
		}

		#endregion

		#region IDisposable Members

		public void Dispose()
		{
			
		}

		#endregion
	}
}
